<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>填写订单信息 - 爽客网</title>
<%@include file="../common/js.jsp" %>
<%@include file="../common/css.jsp" %>

<link href="css/detail.css" type="text/css" rel="stylesheet" />
</head>
<body>
<%@include file="../common/header.jsp" %>
<div class="wrap">
    	<div class="w980 mg">
            <div class="order_tip"></div>
            <div class="f_order_title">
            	<span class="fl">预订：</span><i class="fl">${product.name}</i>
            </div>
            <!-- content -->
            <form action="probuy.htm" method="post" id="order_form">
            <input type="hidden" name="tid" value="${product.id}"/>
            <input type="hidden" name="orderTime" value="${udate}"/>
            <div class="f_detail_box">
            	<!-- pro-info-->
            	<div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>产品信息</h1>
                    <table class="f_order_list dis1">
                    	<thead>
                    		<tr>
	                    		<c:if test="${not empty udate }"><th class="col1">游玩日期</th></c:if>
	                            <th class="col2">名称</th>
	                            <th class="col3">门市价</th>
	                            <th class="col4">爽客价</th>
	                            <th class="col5">数量</th>
	                            <th class="col6">小计</th>
                            </tr>
                        </thead>
                    	<tbody>
                        	<tr>
                        		<c:if test="${not empty udate }"><td class="col1"><span>${udate}</span></td></c:if>
                                <td class="col2"><a href="product.htm?id=${tid}" class="clrblue">${product.name}</a></td>
                                <td class="col3"><i style="text-decoration:line-through;">¥${buytp.priceA}</i></td>
                                <td class="col4"><span>¥${buytp.priceA}</span></td>
                                <td class="col5">
                                	<div class="nums_wrap">
                                        <a href="javascript:;" class="f_orderbg minus" onclick="minusOne();"></a>
                                        <input type="text" value="${count}" name="count" id="rnums" readonly="readonly"/>
                                        <a href="javascript:;" class="f_orderbg add" onclick="addOne();"></a>
                                    </div>
                                </td>
                                <td class="col6"><span>¥</span><span id="totalM">${buytp.priceA * count}</span></td>
                            </tr>
                        </tbody>
                    </table>
                     <c:if test="${not empty product.feeInfo}">
	                    <div class="dis1 instruc_wrap">
	                    	<ul class="f_instruc clearfix">
	                        	<li class="current">
	                        		费用说明
	                            </li>
	                            <%--<li>
	                            	退款说明
	                            </li>
	                        --%></ul>
		                       <div class="content">
		                        	${product.feeInfo}
		                        </div>
	                    </div>
                    </c:if>
                </div>
                <!-- pro-info--end -->
                <!-- producter-info -->
                <div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>取票人信息<span class="clrc06">（请准确填写取票人信息，我们将向取票人手机发送订单短信）</span></h1>
                    <ul class="input_info dis1">
                    	<li>
                        	<label><i class="alarm">*</i>联系人姓名：</label>
                            <input type="text" id="contactor" name="contactor"/>
                        </li>
                        <li>
                        	<label><i class="alarm">*</i>联系人手机：</label>
                            <input type="text" name="phone" id="phone"/>
                            <span class="mt10 ml10"> （免费接收短信，作为订购与取票凭证，请准确填写）</span>
                        </li>
                        <c:if test="${product.needInvoice}">
                        	<li>
	                        	<label><i class="alarm"></i>发票抬头：</label>
	                            <input type="text" id="invoice" name="invoice"/>
	                        </li>
                        </c:if>
                        
                        <c:if test="${product.needAddress}">
                        	<li>
	                        	<label><i class="alarm">*</i>收件地址：</label>
	                        	<input name="proName" id="pro_name" type="hidden"/>
	                        	<input name="cityName" id="city_name" type="hidden"/>
	                        	<select id="province" name="province" style="float: left;width: 120px;height: 26px;"></select><select id="city" name="city" style="float: left;width: 120px;height: 26px;margin-left: 10px;"></select>
	                            <input type="text" id="address" name="address" style="margin-left: 10px;width: 300px;"/>
	                            
	                        </li>
                        </c:if>
                    </ul>
                </div>
                <!-- producter-info--end -->
                <!-- orderbak -->
                <div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>订单备注</h1>
                    <ul class="input_info dis1 remark">
                    	<li>
                        	<label>订单备注：</label>
                            <textarea rows="4" cols="70" name="memo" id="memo"></textarea>
                        </li>
                    </ul>
                </div>
                <!-- orderbak--end -->
                <div class="f_price_wrap">
                	<span>产品金额：</span> 应付：<span class="f_pay_price"><em>¥</em><em id="totalOrder">${buytp.priceA * count}</em></span>
                </div>
                <div class="f-order_commit">
                	<input type="button"  value="确认下单" class="f_orderbg f_btn_sub" id="order_bt"/>
                    <input type="checkbox" class=" cb_style" checked="checked" name="coolprotocol" id="coolprotocol"/><label class="clrblue" for="coolprotocol">同意爽客票务预订协议</label>
                </div>
            </div>
            </form>
            <!-- content--end-->
        </div>
    </div>
    <script type="text/javascript">
    	$(function(){
    		provinceChange("province", "city", "county", null,"","",null,null);
    		
    		$("#order_bt").click(function(){
    			var contactor = $("#contactor").val();
	    		if(IsNull(contactor)){
	    			alert("请输入联系人");
	    			return ;
	    		}
	    		if($("#province").size() > 0 && $("#city").size() > 0){
	    			var province = $("#province").val();
		    		var city = $("#city").val();
		    		var address = $("#address").val();
		    		if(province=='0'){
		    			alert("请选择省");
		    			return ;
		    		}else{
		    			$("#pro_name").val($('#province option:selected').text());
		    		}
		    		if(city=='0'){
		    			alert("请选择市");
		    			return ;
		    		}else{
		    			$("#city_name").val($('#city option:selected').text());
		    		}
		    		if(IsNull(address)){
		    			alert("请填写详细地址");
		    			return ;
		    		}
	    		}
	    		
	    		
	    		
	    		
	    		var phone = $("#phone").val();
	    		if(GGTOOL.mobileCheck(document.getElementById("phone"))){
	    			if(COOL.checkLogin()){
	    				$("#order_form").submit();
	    			}else{
	    				COOL.memberLogin();
	    			}
	    			
	    		}
    		});
    	});
    	
    	function minusOne(){
    		var obj=$("#rnums");
    		var m=parseFloat($("#totalM").val());
    		var n=parseInt(obj.val());
    		if(n-1>0){
    			obj.val(n-1);
    			var p=parseFloat("${buytp.priceA}")*(n-1);
    			$("#totalOrder").html(p);
    			$("#totalM").html(p);
    		}else{
    			alert("最小起订量为1");	
    		}
    		
    	}
    	
    	function addOne(){
    		var obj=$("#rnums");
    		var n=parseInt(obj.val());
			obj.val(n+1);
			var p=parseFloat("${buytp.priceA}")*(n+1);
			$("#totalOrder").html(p);
			$("#totalM").html(p);
    		
    	}
    	
    </script>
</body>
</html>
